<h1>Listing users</h1>
<%if session[:role] == 0 %>
	<table border=1>
	  <tr>
	  <% for column in User.content_columns %>
	    <th><%= column.human_name %></th>
	  <% end %>
		<th colspan="3">Action</th>
	  </tr>
	  
	 
		<% for user in @users %>
		  <tr>
		  <% for column in User.content_columns %>
		    <td><%=h user.send(column.name) %></td>
		  <% end %>
		    <td><%= link_to 'Show', :action => 'show', :id => user %></td>
		    <td><%= link_to 'Edit', :action => 'edit', :id => user %></td>
			<!--Mail link is removed because it exist already ander the create a new user event-->
			<!--td><%= link_to 'Mail', :action => 'mail', :id => user %></td-->
		    <td><%= link_to 'Delete', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post %></td>
		  </tr>
		<% end %>
	
	</table>
	
	<%= link_to 'Previous page', { :page => @user_pages.current.previous } if @user_pages.current.previous %>
	<%= link_to 'Next page', { :page => @user_pages.current.next } if @user_pages.current.next %> 
	
	<br />
	
	<%= link_to 'New Player', :action => 'new' %>

<%else%>
	<table border=1>
	  <tr>
	  <!--% for column in User.content_columns %-->
	    <th>Player</th>
		<th>Role</th>
		<th>Email</th>
		<th>Mobile</th>
	  <!--% end %-->
		
	  </tr>
	
		<% for user in @users %>
		  <tr>
		  <!--% for column in User.content_columns %-->
		   
		    <td><%=h user.send("user_name") %></td>
			<td><%=h user.send("role") %></td>
			<td><%=h user.send("email") %></td>
			<td><%=h user.send("mobile") %></td>
		  <!--% end %-->
		    
		  </tr>
		 <% end %>
	
	</table>
	
	<%= link_to 'Previous page', { :page => @user_pages.current.previous } if @user_pages.current.previous %>
	<%= link_to 'Next page', { :page => @user_pages.current.next } if @user_pages.current.next %> 
	
	<br />

<% end %>
